<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<title>菜单之事件 - jQuery EasyUI 演示</title>
	<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
	<link rel="stylesheet" type="text/css" href="../../themes/default/easyui.css">
	<link rel="stylesheet" type="text/css" href="../../themes/icon.css">
	<link rel="stylesheet" type="text/css" href="../demo.css">
	<script type="text/javascript" src="../../jquery.min.js"></script>
	<script type="text/javascript" src="../../jquery.easyui.min.js"></script>
</head>
<body>
	<h2 title="Menu Events">菜单之事件</h2>
	<p title="Right click on page to display menu and click an item.">　　PC鼠标右键点击页面即可显示菜单，点击其某一子项。注：移动设备长按2秒即可。</p>
	<div style="margin:20px 0;"></div>
	<div id="mm" class="easyui-menu" data-options="onClick:menuHandler" style="width:120px;">
		<div data-options="name:'new'">新建</div>
		<div data-options="name:'save',iconCls:'icon-save'">保存</div>
		<div data-options="name:'print',iconCls:'icon-print'">打印</div>
		<div class="menu-sep"></div>
		<div data-options="name:'exit'">退出</div>
	</div>
	<div id="log" class="easyui-panel" title="事件日志" style="height:250px;padding:10px">
	</div>
	<script>
		function menuHandler(item){
			$('#log').prepend('<p>点击了菜单项：'+item.name+'</p>');
		}
		$(function(){
			$(document).bind('contextmenu',function(e){
				e.preventDefault();
				$('#mm').menu('show', {
					left: e.pageX,
					top: e.pageY
				});
			});
		});
	</script>
</body>
</html>